import { inject, Ref } from 'vue'
import { ServiceVersionVOType } from '@coolphk/shared-types/low-code'
import { useDesigner, useFormConfig } from '@/composable'
import { PROVIDE_KEY } from '@/utils/constants'

export function useLatestServiceVersionVOs(): ServiceVersionVOType[] {
  // console.log(333, useDesigner().currentServiceVersionVOs)
  return useDesigner().currentServiceVersionVOs
  // return getLatestServiceVersionVOs()
}

export function useFormServiceVersionVOs() {
  return useFormConfig().serviceVersionVOs
}

export function useCloneFormServiceVersionVOs(): Ref<ServiceVersionVOType[]> {
  return inject<Ref<ServiceVersionVOType[]>>(PROVIDE_KEY.CLONE_SERVICE_VERSION_VOS)
}
